﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SPIWareMVVM.ViewModels;
using System.Windows;
using DataAccess;

namespace SPIWareMVVM.Views.Commands
{
    public class ShowCommissionListCommand : BaseCommand
    {
        public ShowCommissionListCommand(BaseViewModel sender) : base(sender) { }
        public override void Execute(object parameter)
        {
            if (parameter.GetType() == typeof(CommissionList))
            {
                CommissionList list = (CommissionList)parameter;
                if (list != null)
                {
                    list.lbCommissions.SelectedIndex = -1;
                    if (mainWindow == null) mainWindow = (Window1)Window.GetWindow((CommissionList)list);
                    if (mainWindow != null)
                    {
                        ApplicationData.ClearSelected(ApplicationData.AllSelectable);
                        mainWindow.HideLists();
                    }
                }
            }
        }
    }
}
